#!/usr/bin/python
# -*- coding:UTF-8 -*-

import requests
import time

def check_webside(url):
	try:
		response = requests.get(url)
		if 200 == response.status_code:
			return("Ture")
		else:
			return("False")
	except requests.exceptions.RequestException as e:
		return("Failed")

def to_excel(outdir, name):
    from openpyxl import Workbook
    wb = Workbook()
    ws = wb.active
    for j in outdir:
        ws.append(j)
        wb.save(name)
       
def run():
    output = []
    with open('111.txt', 'r') as fp:#放列表的文件
        for i in fp:
            print(i)
            ttt = []
            ttt.append(i)
            url = "https://gitee.com/openharmony-sig/" + i#拼接url
            sss = url.replace('\n', '')
            aaa = check_webside(str(sss))
            ttt.append(aaa)
            print(sss + " is " + aaa)
            time.sleep(0.2)
        output.append(ttt)
    to_excel(output,'111.xlsx')#输出文件名
    
if __name__ == '__main__':
    run()
    